<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>对象</title>
	<script type="text/javascript">
		//直接实例对象
		// arr = new Array();
		dongwu = new Object(); 
		dongwu.name = "大象";
		dongwu.color = "红色";
		dongwu.sex = "公的";
		dongwu.chi = function (x) {
			alert(x+"大象可以吃");
		}
		dongwu.pao = function () {
			alert("大象可以跑");
		}

		dongwu.max = function  (x) {
			max=0;
	 		for (var i = 0; i < x.length; i++) {
	 			if(x[i]>max){
	 				max=x[i];
	 			}
	 		};

	 		return max;
		}
		// dongwu.name;
		// dongwu.chi("我要");
		// // 
		// console.log(dongwu);

		// arr = [45,5,78,90,45,2,234,34,34];

		// res = dongwu.max(arr);

		// alert(res);



		function car(name){
			this.name=name;
			this.length=3.5;
			this.color="红色";
			this.run=function()
			{
				alert("奥迪可以跑");
			}
		}
		// obj = new car("奥迪");
		// obj.price = 456546;
		// obj.zairen = function  () {
		// 	alert("奥迪可以载人");
		// }
		// alert(obj.run());



		// obj = new car("迪奥");
		// alert(obj.name);

		// console.log(obj);

		// json ={fname:"Bill",lname:"Gates",age:56};

		// arr = [54,45,4,54,54,54,5]

		// str = "中国人";


		// for (var x in str) {
		// 	alert(str[0]);
		// };











		



	</script>
</head>
<body>
	<p></p>
</body>
</html>